CREATE PROCEDURE coreAdminUserGetAll
(
	@SortExpression NVarChar(50),
	@SortDirection int
)
AS
BEGIN
 IF @SortDirection > 0
 BEGIN
	IF( @SortExpression = 'PK_ID' )
		SELECT * FROM AdministrationUsers ORDER BY PK_ID ASC;
	IF( @SortExpression = 'EmailAddress' )
		SELECT * FROM AdministrationUsers ORDER BY EmailAddress ASC;
	IF( @SortExpression = 'NT_Username' )
		SELECT * FROM AdministrationUsers ORDER BY NT_Username ASC;
	IF( @SortExpression = 'RealName' )
		SELECT * FROM AdministrationUsers ORDER BY RealName ASC;
 END
 ELSE
 BEGIN
	IF( @SortExpression = 'PK_ID' )
		SELECT * FROM AdministrationUsers ORDER BY PK_ID DESC;
	IF( @SortExpression = 'EmailAddress' )
		SELECT * FROM AdministrationUsers ORDER BY EmailAddress DESC;
	IF( @SortExpression = 'NT_Username' )
		SELECT * FROM AdministrationUsers ORDER BY NT_Username DESC;
	IF( @SortExpression = 'RealName' )
		SELECT * FROM AdministrationUsers ORDER BY RealName DESC;
 END
END